package com.peanut.youfupay.service.other;


import com.alibaba.fastjson.JSON;
import com.peanut.youfupay.entity.request.AccountQuery;
import com.peanut.youfupay.entity.response.AccountQueryResult;
import com.peanut.youfupay.entity.response.ResponseMessage;
import com.peanut.youfupay.enums.FunCodeEnum;
import com.peanut.youfupay.service.BaseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 商户查询账户可用余额
 *
 * @author peanut
 */
@Service
@Slf4j
public class AccountQueryService extends BaseService {
    /**
     * @param funCodeEnum
     * @param accountQuery
     * @return
     * @throws Exception
     */
    public AccountQueryResult doBusiness(FunCodeEnum funCodeEnum, AccountQuery accountQuery) throws Exception {
        log.info("商户账户余额查询开始:{}，{}", funCodeEnum, accountQuery);
        ResponseMessage responseMessage = applyYouFuByHttpPost(funCodeEnum, accountQuery);
        AccountQueryResult accountQueryResult = JSON.parseObject(responseMessage.getResData(), AccountQueryResult.class);
        log.info("商户账户余额查询结束:{}", accountQueryResult);
        return accountQueryResult;
    }
}
